#include <array>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>

#define VNAME(name) #name
#define debugln(x) {auto debugx = x; std::cout << "(" << VNAME(x) << ": " << debugx << ")" << std::endl;}
using namespace std;
const int N = 1e8 + 5;
std::multimap<int, int> M;
char is_p[N];
int p[N >> 4];
int d;
void prime(int n = 1e8 + 1) {
    for (int i = 2; i <= n; ++ i) {
        if (!is_p[i]) p[d ++] = i;
        for (int j = 0; i * p[j] <= n; ++ j) {
            is_p[i * p[j]] = true;
            if (i % p[j] == 0) break;
        }
    }
}
signed main() {
    debugln(1<<24);
    prime();
    int n;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    while (cin >> n && n != 0) {
        cout << upper_bound(p, p + d + 1, n) - p << '\n'; 
    }
    cout << endl;
    system("pause");
    return 0;
}